﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Migrations
{
    /// <inheritdoc />
    public partial class add_column_version : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "Ver",
                table: "SfConfig",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Ver",
                table: "MainStdModelConfig",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Ver",
                table: "MainStConfig",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateIndex(
                name: "IX_MainStdModelConfig_ProjectConfigId",
                table: "MainStdModelConfig",
                column: "ProjectConfigId");

            migrationBuilder.AddForeignKey(
                name: "FK_MainStdModelConfig_MainProjectConfig_ProjectConfigId",
                table: "MainStdModelConfig",
                column: "ProjectConfigId",
                principalTable: "MainProjectConfig",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MainStdModelConfig_MainProjectConfig_ProjectConfigId",
                table: "MainStdModelConfig");

            migrationBuilder.DropIndex(
                name: "IX_MainStdModelConfig_ProjectConfigId",
                table: "MainStdModelConfig");

            migrationBuilder.DropColumn(
                name: "Ver",
                table: "SfConfig");

            migrationBuilder.DropColumn(
                name: "Ver",
                table: "MainStdModelConfig");

            migrationBuilder.DropColumn(
                name: "Ver",
                table: "MainStConfig");
        }
    }
}
